package contentSpider;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

public class Test {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws JDOMException 
	 */
	public static void main(String[] args) throws JDOMException, IOException {

		SAXBuilder builder = new SAXBuilder(false);
		Document doc = builder.build("spiderSuit.xml");
		Element parameter = doc.getRootElement();
		List sourceSiteParameterList = parameter.getChildren("sourceSite");
		for (Iterator<?> iter = sourceSiteParameterList.iterator(); iter.hasNext();) {
			Element element = (Element) iter.next();
			int sourceNet = new Integer(element.getChildTextTrim("sourceNet")).intValue();
			String titleRex = element.getChildTextTrim("titleRex");
			String contentget = element.getChildTextTrim("contentget");
			String contentdel = element.getChildTextTrim("contentdel");
			String proxyCon = element.getChildTextTrim("proxyCon");
			String cookiesCon = element.getChildTextTrim("cookiesCon");
			ContentSpider cs = new ContentSpider();
			cs.setContentRex(contentget);
			cs.setCookiesString(cookiesCon);
			cs.setdBHost("192.168.0.7");
			cs.setdBName("feiji");
			cs.setDelRex(contentdel);
			cs.setProxyString(proxyCon);
			cs.setSourceNet(sourceNet);
			cs.setTitleRex(titleRex);
			cs.contentSpider();
		}
		
	}
}
